{
  "nbformat": 4,
  "nbformat_minor": 2,
  "metadata": {
    "colab": {
      "name": "🛠 00_TensorFlow_Fundamentals-🛠 Exercises & 📖 Extra-curriculum.ipynb",
      "provenance": [],
      "collapsed_sections": [],
      "include_colab_link": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3.8.3 64-bit"
    },
    "accelerator": "GPU",
    "language_info": {
      "name": "python",
      "version": "3.8.3",
      "mimetype": "text/x-python",
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "pygments_lexer": "ipython3",
      "nbconvert_exporter": "python",
      "file_extension": ".py"
    },
    "interpreter": {
      "hash": "bf999ac285d0022b0e4ae5ef145e9170d53604089d01f50b2d68c2738cd724d9"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "source": [
        "<a href=\"https://colab.research.google.com/github/mrdbourke/tensorflow-deep-learning/blob/main/extras/solutions/%F0%9F%9B%A0%2000_TensorFlow_Fundamentals_%F0%9F%9B%A0_Exercises_%26_%F0%9F%93%96_Extra_curriculum.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ],
      "metadata": {
        "id": "view-in-github",
        "colab_type": "text"
      }
    },
    {
      "cell_type": "code",
      "execution_count": 2,
      "source": [
        "# Import TensorFlow\r\n",
        "import tensorflow as tf\r\n",
        "print(tf.__version__)"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "2.3.1\n"
          ]
        }
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "JnkvYYRn6TN7",
        "outputId": "bb179f5a-0421-4cae-aaf5-2701b7615039"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "# Exercise \n",
        "\n",
        "## 🛠 00 TensorFlow Fundamentals Exercises\n",
        "\n",
        "1. Create a vector, scalar, matrix and tensor with values of your choosing using `tf.constant()`.\n",
        "2. Find the **shape**, **rank** and **size** of the tensors you created in 1.\n",
        "3. Create two tensors containing random values between 0 and 1 with shape `[5, 300]`.\n",
        "4. Multiply the two tensors you created in 3 using **matrix multiplication**.\n",
        "5. Multiply the two tensors you created in 3 using **dot product**.\n",
        "6. Create a tensor with **random values** between 0 and 1 with shape `[224, 224, 3]`.\n",
        "7. Find the **min** and **max values** of the tensor you created in 6.\n",
        "8. Created a tensor with random values of shape `[1, 224, 224, 3]` then **squeeze** it to change the shape to `[224, 224, 3]`.\n",
        "9. Create a tensor with shape `[10]` using your own choice of values, then find the **index** which has the **maximum value**.\n",
        "10. **One-hot** encode the tensor you created in 9."
      ],
      "metadata": {
        "id": "Iw4TzuJI6j18"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "### 1. Create a vector, scalar, matrix and tensor with values of your choosing using `tf.constant()`.\n"
      ],
      "metadata": {
        "id": "FIOGM_327m0m"
      }
    },
    {
      "cell_type": "code",
      "execution_count": 3,
      "source": [
        "# Creating a scalar \r\n",
        "scalar = tf.constant(8)\r\n",
        "\r\n",
        "# Creating a vector \r\n",
        "vector = tf.constant([1 , 2 , 3])\r\n",
        "\r\n",
        "# Creating a matrix \r\n",
        "matrix = tf.constant([[1 ,2] , \r\n",
        "                      [3, 4]])\r\n",
        "\r\n",
        "# Creating a tensor \r\n",
        "tensor = tf.constant(\r\n",
        "                      [\r\n",
        "                          [\r\n",
        "                              [10 , 9 , 8] , \r\n",
        "                              [1 ,2 , 4], \r\n",
        "                              [8 , 4 , 2]\r\n",
        "                          ]\r\n",
        "                          ,\r\n",
        "                          [\r\n",
        "                              [10 , 9 , 8] , \r\n",
        "                              [1 ,2 , 4], \r\n",
        "                              [8 , 4 , 2]\r\n",
        "                          ]\r\n",
        "                      ]\r\n",
        "                     )\r\n",
        "\r\n",
        "scalar , vector , matrix , tensor "
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "(<tf.Tensor: shape=(), dtype=int32, numpy=8>,\n",
              " <tf.Tensor: shape=(3,), dtype=int32, numpy=array([1, 2, 3])>,\n",
              " <tf.Tensor: shape=(2, 2), dtype=int32, numpy=\n",
              " array([[1, 2],\n",
              "        [3, 4]])>,\n",
              " <tf.Tensor: shape=(2, 3, 3), dtype=int32, numpy=\n",
              " array([[[10,  9,  8],\n",
              "         [ 1,  2,  4],\n",
              "         [ 8,  4,  2]],\n",
              " \n",
              "        [[10,  9,  8],\n",
              "         [ 1,  2,  4],\n",
              "         [ 8,  4,  2]]])>)"
            ]
          },
          "metadata": {},
          "execution_count": 3
        }
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "JodClH_78XGZ",
        "outputId": "49db8ce1-b523-43ec-fb89-c87a0e935313"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "### 2. Find the **shape**, **rank** and **size** of the tensors you created in 1."
      ],
      "metadata": {
        "id": "r78HsqqN7w2L"
      }
    },
    {
      "cell_type": "code",
      "execution_count": 4,
      "source": [
        "# Finding the shape, rank and size\r\n",
        "print(f'The shape of the tensor: {tensor.shape}')\r\n",
        "print(f'The rank of the tensor: {tf.size(tensor)}')\r\n",
        "print(f'The rank of the tensor: {tf.rank(tensor)}')"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "The shape of the tensor: (2, 3, 3)\n",
            "The rank of the tensor: 18\n",
            "The rank of the tensor: 3\n"
          ]
        }
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "47R_l10p8b0E",
        "outputId": "f0c84e19-141c-4342-8650-9e9f62c447e6"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "### 3. Create two tensors containing random values between 0 and 1 with shape `[5, 300]`.\n"
      ],
      "metadata": {
        "id": "8IhsQmQg74Ct"
      }
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "source": [
        "# Set seed\r\n",
        "tf.random.set_seed(42)\r\n",
        "\r\n",
        "# Setting up the shape \r\n",
        "tensor_1 = tf.random.uniform(shape=(5, 300))\r\n",
        "tensor_2 = tf.random.uniform(shape=(5, 300))\r\n",
        "\r\n",
        "tensor_1, tensor_1.shape, tensor_2, tensor_2.shape"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "(<tf.Tensor: shape=(5, 300), dtype=float32, numpy=\n",
              " array([[0.6645621 , 0.44100678, 0.3528825 , ..., 0.31410468, 0.7593535 ,\n",
              "         0.03699052],\n",
              "        [0.532024  , 0.29129946, 0.10571766, ..., 0.54052293, 0.31425726,\n",
              "         0.2200619 ],\n",
              "        [0.08404207, 0.03614604, 0.97732127, ..., 0.21516645, 0.9786098 ,\n",
              "         0.00726748],\n",
              "        [0.7396945 , 0.6653172 , 0.0787828 , ..., 0.7117733 , 0.07013571,\n",
              "         0.9409125 ],\n",
              "        [0.15861344, 0.12024033, 0.27218235, ..., 0.8824879 , 0.1432488 ,\n",
              "         0.44135118]], dtype=float32)>,\n",
              " TensorShape([5, 300]),\n",
              " <tf.Tensor: shape=(5, 300), dtype=float32, numpy=\n",
              " array([[0.68789124, 0.48447883, 0.9309944 , ..., 0.6920762 , 0.33180213,\n",
              "         0.9212563 ],\n",
              "        [0.27369928, 0.10631859, 0.6218617 , ..., 0.4382149 , 0.30427706,\n",
              "         0.51477313],\n",
              "        [0.00920248, 0.37280262, 0.8177401 , ..., 0.56786287, 0.49201214,\n",
              "         0.9892651 ],\n",
              "        [0.88608265, 0.08672249, 0.12160683, ..., 0.91770685, 0.72545695,\n",
              "         0.8280058 ],\n",
              "        [0.36690474, 0.9200133 , 0.9646884 , ..., 0.69012   , 0.7137332 ,\n",
              "         0.2584542 ]], dtype=float32)>,\n",
              " TensorShape([5, 300]))"
            ]
          },
          "metadata": {},
          "execution_count": 5
        }
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "qtmV-5f18eEH",
        "outputId": "3388be23-6b88-4c8e-abd9-7c4e19e64d0e"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "### 4. Multiply the two tensors you created in 3 using **matrix multiplication**.\n"
      ],
      "metadata": {
        "id": "YVkN1Zyh7_Qk"
      }
    },
    {
      "cell_type": "code",
      "execution_count": 6,
      "source": [
        "# Multiplying\r\n",
        "print('Shape before the matrix multiplication')\r\n",
        "print(tensor_1.shape , '\\n')\r\n",
        "print(tensor_2.shape , '\\n')\r\n",
        "\r\n",
        "resultant_vector = tf.linalg.matmul(tensor_1 , tf.transpose(tensor_2))\r\n",
        "print(f'After multiplying the resultant vector is: {resultant_vector} \\n')\r\n",
        "\r\n",
        "print(f'The resultant vector shape: {resultant_vector.shape}')"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Shape before the matrix multiplication\n",
            "(5, 300) \n",
            "\n",
            "(5, 300) \n",
            "\n",
            "After multiplying the resultant vector is: [[80.33345  73.40498  77.159615 73.98369  80.90053 ]\n",
            " [75.146355 68.80437  74.24302  71.841835 75.60206 ]\n",
            " [79.7594   75.644554 77.797585 74.74873  80.559845]\n",
            " [75.08526  69.064064 74.30776  72.27616  76.05669 ]\n",
            " [85.05688  74.26627  78.00687  74.88679  83.13417 ]] \n",
            "\n",
            "The resultant vector shape: (5, 5)\n"
          ]
        }
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "zAjGjzbu8gq-",
        "outputId": "80effbb7-b876-4bf5-9dc1-d55d9aaf6ba8"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "### 5. Multiply the two tensors you created in 3 using **dot product**.\n"
      ],
      "metadata": {
        "id": "RlMKgEu58Cd9"
      }
    },
    {
      "cell_type": "code",
      "execution_count": 7,
      "source": [
        "# Using tensordot\r\n",
        "tf.tensordot(tensor_1 , tf.transpose(tensor_2) , axes=1)"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "<tf.Tensor: shape=(5, 5), dtype=float32, numpy=\n",
              "array([[80.33345 , 73.40498 , 77.159615, 73.98369 , 80.90053 ],\n",
              "       [75.146355, 68.80437 , 74.24302 , 71.841835, 75.60206 ],\n",
              "       [79.7594  , 75.644554, 77.797585, 74.74873 , 80.559845],\n",
              "       [75.08526 , 69.064064, 74.30776 , 72.27616 , 76.05669 ],\n",
              "       [85.05688 , 74.26627 , 78.00687 , 74.88679 , 83.13417 ]],\n",
              "      dtype=float32)>"
            ]
          },
          "metadata": {},
          "execution_count": 7
        }
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "y4rJ_P9u8j-w",
        "outputId": "f7dea9a1-8f8e-41d1-afc4-e42227fda9b8"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "### 6. Create a tensor with **random values** between 0 and 1 with shape `[224, 224, 3]`.\n"
      ],
      "metadata": {
        "id": "pguA2uQB8FKB"
      }
    },
    {
      "cell_type": "code",
      "execution_count": 8,
      "source": [
        "# Tensor with shape [224 , 224 , 3]\r\n",
        "big_tensor = tf.random.uniform(shape = [224 , 224 , 3], minval = 0 , maxval = 1)\r\n",
        "\r\n",
        "big_tensor"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "<tf.Tensor: shape=(224, 224, 3), dtype=float32, numpy=\n",
              "array([[[0.7413678 , 0.62854624, 0.01738465],\n",
              "        [0.3431449 , 0.51063764, 0.3777541 ],\n",
              "        [0.07321596, 0.02137029, 0.2871771 ],\n",
              "        ...,\n",
              "        [0.98953485, 0.45382905, 0.2006687 ],\n",
              "        [0.6295223 , 0.4937899 , 0.01816809],\n",
              "        [0.95386636, 0.11542463, 0.85691285]],\n",
              "\n",
              "       [[0.78435016, 0.7826872 , 0.87936425],\n",
              "        [0.24906898, 0.3207239 , 0.10955775],\n",
              "        [0.543224  , 0.7151396 , 0.40334642],\n",
              "        ...,\n",
              "        [0.2445668 , 0.01746976, 0.9036933 ],\n",
              "        [0.02975535, 0.592268  , 0.9877522 ],\n",
              "        [0.36701274, 0.33112562, 0.5638567 ]],\n",
              "\n",
              "       [[0.15829337, 0.7288823 , 0.3366307 ],\n",
              "        [0.70792687, 0.16910625, 0.9429966 ],\n",
              "        [0.10120225, 0.5919596 , 0.8687303 ],\n",
              "        ...,\n",
              "        [0.28134012, 0.10011208, 0.37038183],\n",
              "        [0.77874243, 0.05421627, 0.4664607 ],\n",
              "        [0.2549187 , 0.7968637 , 0.83405185]],\n",
              "\n",
              "       ...,\n",
              "\n",
              "       [[0.32922816, 0.06343532, 0.23936498],\n",
              "        [0.42692196, 0.3615111 , 0.901929  ],\n",
              "        [0.8320831 , 0.21068895, 0.08272386],\n",
              "        ...,\n",
              "        [0.65110314, 0.40780962, 0.25967455],\n",
              "        [0.9018173 , 0.8245677 , 0.16757596],\n",
              "        [0.41854453, 0.19092035, 0.2523303 ]],\n",
              "\n",
              "       [[0.7064005 , 0.222404  , 0.82219553],\n",
              "        [0.8235872 , 0.76544905, 0.80999327],\n",
              "        [0.1100682 , 0.00520217, 0.6127168 ],\n",
              "        ...,\n",
              "        [0.98068535, 0.8958733 , 0.17706168],\n",
              "        [0.4252876 , 0.02087164, 0.496238  ],\n",
              "        [0.6599953 , 0.58505726, 0.7089884 ]],\n",
              "\n",
              "       [[0.90045786, 0.45803344, 0.9050728 ],\n",
              "        [0.92233   , 0.38456154, 0.30329156],\n",
              "        [0.03238845, 0.18773472, 0.9096625 ],\n",
              "        ...,\n",
              "        [0.4445815 , 0.04578841, 0.21090853],\n",
              "        [0.25966525, 0.24412918, 0.76123405],\n",
              "        [0.9643831 , 0.32687283, 0.4828869 ]]], dtype=float32)>"
            ]
          },
          "metadata": {},
          "execution_count": 8
        }
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "lY_xmH7n8nc7",
        "outputId": "29f037c2-9470-47fc-d32b-27f1bc85870f"
      }
    },
    {
      "cell_type": "code",
      "execution_count": 9,
      "source": [
        "# Checking the min and max value of our tensor \r\n",
        "print(f'Maximum value: {tf.reduce_max(big_tensor)}')\r\n",
        "print(f'Minimum value: {tf.reduce_min(big_tensor)}')"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Maximum value: 0.999991774559021\n",
            "Minimum value: 2.384185791015625e-07\n"
          ]
        }
      ],
      "metadata": {
        "id": "m41XLPFgXqsu",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "2293e0a8-e0c8-40df-b524-37a93296821f"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "### 7. Find the **min** and **max values** of the tensor you created in 6.\n"
      ],
      "metadata": {
        "id": "0chI1fy78IGx"
      }
    },
    {
      "cell_type": "code",
      "execution_count": 10,
      "source": [
        "# Finding the minimum \r\n",
        "minimum = tf.math.reduce_min(big_tensor)\r\n",
        "print(f'The minimum value is: {minimum}')"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "The minimum value is: 2.384185791015625e-07\n"
          ]
        }
      ],
      "metadata": {
        "id": "pKa8cpjZ8qTO",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "f6c8bf49-4b19-460c-c4f4-9561c2fb8ee0"
      }
    },
    {
      "cell_type": "code",
      "execution_count": 11,
      "source": [
        "# Finding the maximum \r\n",
        "maximum = tf.math.reduce_max(big_tensor)\r\n",
        "print(f'The maximum value is: {maximum}')"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "The maximum value is: 0.999991774559021\n"
          ]
        }
      ],
      "metadata": {
        "id": "L_VLjA8v8rNT",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "75a088e5-a40c-4fb7-e22d-35c717c46d7b"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "### 8. Created a tensor with random values of shape `[1, 224, 224, 3]` then **squeeze** it to change the shape to `[224, 224, 3]`.\n"
      ],
      "metadata": {
        "id": "ImNsRvtD8KdT"
      }
    },
    {
      "cell_type": "code",
      "execution_count": 12,
      "source": [
        "# Tensor with shape [224 , 224 , 3]\r\n",
        "unsqueezed_tensor = tf.random.Generator.from_seed(42)\r\n",
        "unsqueezed_tensor = unsqueezed_tensor.normal(shape = (1 , 224 , 224 , 3))\r\n",
        "\r\n",
        "print(f'The shape before squeezing: {unsqueezed_tensor.shape}')"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "The shape before squeezing: (1, 224, 224, 3)\n"
          ]
        }
      ],
      "metadata": {
        "id": "RoTvHZn08vBD",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "01bd01a7-9622-4dad-ec33-35bee95c4779"
      }
    },
    {
      "cell_type": "code",
      "execution_count": 13,
      "source": [
        "# And we are squeezing it \r\n",
        "squeezed_tensor = tf.squeeze(unsqueezed_tensor)\r\n",
        "print(f'The shape after squeezing: {squeezed_tensor.shape}')"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "The shape after squeezing: (224, 224, 3)\n"
          ]
        }
      ],
      "metadata": {
        "id": "sVozBuAP8xKf",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "88f325c1-b268-48fe-d43d-88f153e1d65c"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "### 9. Create a tensor with shape `[10]` using your own choice of values, then find the **index** which has the **maximum value**.\n"
      ],
      "metadata": {
        "id": "F6wEXVTH8NaJ"
      }
    },
    {
      "cell_type": "code",
      "execution_count": 14,
      "source": [
        "ten_tensor = tf.constant([0 ,1 ,2 ,3, 4, 9, 10, 0.1 , -000.1 , 6])\r\n",
        "\r\n",
        "# Finding the index where value is maximum \r\n",
        "max_value = tf.math.argmax(ten_tensor)\r\n",
        "\r\n",
        "print(f'The indices where the value is maximum: {max_value}')\r\n",
        "print(f'The maximum value was: {ten_tensor[max_value]}')"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "The indices where the value is maximum: 6\n",
            "The maximum value was: 10.0\n"
          ]
        }
      ],
      "metadata": {
        "id": "pJMg2JWm8zb3",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "42626845-206b-4ab4-ed49-78d9c1236a39"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "### 10. **One-hot** encode the tensor you created in 9."
      ],
      "metadata": {
        "id": "y2_OW2lv8Pmx"
      }
    },
    {
      "cell_type": "code",
      "execution_count": 15,
      "source": [
        "# Throw's an error since I had floating numbers in my tensor, casting to int solved! \r\n",
        "tf.cast(ten_tensor , dtype=tf.int32)"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "<tf.Tensor: shape=(10,), dtype=int32, numpy=array([ 0,  1,  2,  3,  4,  9, 10,  0,  0,  6])>"
            ]
          },
          "metadata": {},
          "execution_count": 15
        }
      ],
      "metadata": {
        "id": "b3v3w8qA8RBw",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "b14aee52-9408-4c08-a8cd-c9ab47215418"
      }
    },
    {
      "cell_type": "code",
      "execution_count": 16,
      "source": [
        "# One hot encoding the tensor of shape 10 \r\n",
        "tf.one_hot(tf.cast(ten_tensor , dtype=tf.int32) , depth = 10)"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "<tf.Tensor: shape=(10, 10), dtype=float32, numpy=\n",
              "array([[1., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
              "       [0., 1., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
              "       [0., 0., 1., 0., 0., 0., 0., 0., 0., 0.],\n",
              "       [0., 0., 0., 1., 0., 0., 0., 0., 0., 0.],\n",
              "       [0., 0., 0., 0., 1., 0., 0., 0., 0., 0.],\n",
              "       [0., 0., 0., 0., 0., 0., 0., 0., 0., 1.],\n",
              "       [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
              "       [1., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
              "       [1., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
              "       [0., 0., 0., 0., 0., 0., 1., 0., 0., 0.]], dtype=float32)>"
            ]
          },
          "metadata": {},
          "execution_count": 16
        }
      ],
      "metadata": {
        "id": "3CWNoe51812a",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "4ff4f286-1fb2-42ec-e2c8-cf3277f005f1"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "## Extra Curriculum \n",
        "\n",
        "- Try to create a series of tensor functions to calculate your most recent grocery bill (it's okay if you don't use the names of the items, just the price in numerical form).\n",
        "    - How would you calculate your grocery bill for the month and for the year using tensors?"
      ],
      "metadata": {
        "id": "-LfnTPOU83Ze"
      }
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "source": [],
      "outputs": [],
      "metadata": {
        "id": "ihyBfMz29Htr"
      }
    }
  ]
}